import  sys
from PyQt5.QtCore import *
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
class QdockDemo(QMainWindow):
    def __init__(self):
        super(QdockDemo,self).__init__()
        layout=QHBoxLayout()
        bar=self.menuBar()
        file=bar.addMenu("File")
        file.addAction("New")
        file.addAction("save")
        file.addAction("quit")
        self.items=QDockWidget("Dockable",self)
        self.listWidget=QListWidget()
        self.listWidget.addItem("item1")
        self.listWidget.addItem("item2")
        self.listWidget.addItem("item3")
        self.items.setWidget(self.listWidget)
        self.items.setFloating(True)
        self.setCentralWidget(QTextEdit())
        self.addDockWidget(Qt.RightDockWidgetArea,self.items)
        self.setLayout(layout)
        self.setWindowTitle("dock")

if __name__ == '__main__':
    app=QApplication(sys.argv)
    demo=QdockDemo()

    demo.show()
    sys.exit(app.exec_())
